import os

from langchain_core.prompts import load_prompt
from dotenv import load_dotenv

load_dotenv()

# 获取当前文件的目录
current_dir = os.path.dirname(os.path.abspath(__file__))
print("current_dir===", os.path.abspath(current_dir))
# 构建到项目根目录的路径
project_root = os.path.join(current_dir, "..", "..", "..")
print("project_root===", os.path.abspath(project_root))
# 构建到prompt.json文件的路径
prompt_path = os.path.join(project_root, "templates", "prompt", "prompt.json")
print("prompt_path===", os.path.abspath(prompt_path))
# 加载prompt
prompt = load_prompt(os.path.abspath(prompt_path), encoding="utf-8")
print(prompt.format(name="张三", what="搞笑的"))